package base

/*
* @author: hjz
* @time: 2025/4/28 21:44
* 基本的递归和回溯应用
*1 -> 2 -> 3 -> 4 -> 5 -> nil
 */
func reverseList(head *ListNode) *ListNode {
	if head.Next == nil {
		return head
	}
	p := reverseList(head.Next)
	head.Next.Next = head
	head.Next = nil
	return p
}
